import {defineConfig} from 'vite'
import tailwindcss from '@tailwindcss/vite'
import {resolve} from 'path';

export default defineConfig({
    root: 'src',
    base: '/',   // 部署基础路径
    resolve: {
        alias: {
            '@': resolve(__dirname, 'src')
        }
    },
    plugins: [
        tailwindcss(),
    ],
    build: {
        outDir: '../dist',
        emptyOutDir: true,
        rollupOptions: {
            input: {
                // 定义多个 HTML 入口
                index: resolve(__dirname, 'src/pages/index/index.html'),
                login: resolve(__dirname, 'src/pages/login/login.html'),
                // users: resolve(__dirname, 'src/pages/users/[id].html'), // 动态页
            },
        },
    },
    server: {
        port: 5173,
        open: '/pages/index/index.html', // 启动时打开首页
    },
})